<?php defined('_JEXEC') or die('Restricted access'); 
$TableName = JRequest::getVar('table');
JHTML::_('behavior.tooltip');
switch ($TableName)
{
		
		case 'country' :		
?>
<form action="index.php" method="post" name="adminForm">
<table>
	<tr>
		<td align="left" width="100%">
			<?php echo JText::_( 'Filter' ); ?>:
			<input type="text" name="search" id="search" value="<?php echo $this->lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
			<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
			<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
		</td>
		<td nowrap="nowrap">
			<?php echo $this->lists['state']; ?>
		</td>
	</tr>
</table>

<div id="editcell">
<table class="adminlist">
	<thead>
		<tr>
			<th width="5">
				<?php echo JText::_( 'NUM' ); ?>
			</th>
			<th  width="5%">
				<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
			</th>
			<th  class="title">
				<?php echo JHTML::_('grid.sort',   'Country Name', 'name', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>
            
			<th width="5%" align="center">
				<?php echo JHTML::_('grid.sort',   'Published', 'published', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>			
			<th width="1%" nowrap="nowrap">
				<?php echo JHTML::_('grid.sort',   'ID', 'id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>
		</tr>
	</thead>
    
    
<tbody>
	<?php
	$k = 0;
	for ($i=0, $n=count( $this->items ); $i < $n; $i++)
	{
		$row = &$this->items[$i];
$link 		= JRoute::_( 'index.php?option=com_properties&controller=property&table='.$TableName.'&task=edit&cid[]='. $row->id);
		

//$checked 	= JHTML::_('grid.id',   $i, $row->id_categoria );
//$checked 	= JHTML::_('grid.checkedout',   $row, $i );
		
		$checked 	= JHTML::_('grid.id',  $i, $row->id );
		$published 	= JHTML::_('grid.published', $row, $i );
	?>
		<tr class="<?php echo "row$k"; ?>">
			<td width="5%">
				<?php echo $this->pagination->getRowOffset( $i ); ?>
			</td>
			<td width="5%">
				<?php echo $checked; ?>
			</td>
			<td>
			<?php //if (  JTable::isCheckedOut($this->user->get ('id'), $row->checked_out )  ) {
				//echo $row->title;
			//} else {
				?>
				<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Country' );?>::<?php echo $row->name; ?>">
				<a href="<?php echo $link  ?>">
					<?php echo $row->name; ?></a></span>
				<?php
			//}
			?>
			</td>
			<td align="center">
				<?php echo $published;?>
			</td>			
			<td align="center">
				<?php echo $row->id; ?>
			</td>
		</tr>
		<?php
			$k = 1 - $k;
		}
		?>
	</tbody>     

<tfoot>
    <tr>
      <td colspan="13"><?php echo $this->pagination->getListFooter(); ?></td>
    </tr>
  </tfoot>
</table>
</div>
<input type="hidden" name="option" value="com_properties" />
<input type="hidden" name="table" value="<?php echo $TableName; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
<input type="hidden" name="controller" value="property" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
<?php	///////////////////////////////////////provincias/////////////////////
break;	


	case 'state' :		
?>
<form action="index.php" method="post" name="adminForm">
<table>
	<tr>
		<td align="left" width="100%">
			<?php echo JText::_( 'Filter' ); ?>:
			<input type="text" name="search" id="search" value="<?php echo $this->lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
			<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
			<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
		</td>
		<td nowrap="nowrap">
			<?php echo $this->lists['state']; ?>
		</td>
	</tr>
</table>

<div id="editcell">
<table class="adminlist">
	<thead>
		<tr>
			<th width="5">
				<?php echo JText::_( 'NUM' ); ?>
			</th>
			<th  width="5%">
				<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
			</th>
			<th  class="title">
				<?php echo JHTML::_('grid.sort',   'State Name', 'name', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>
            <th  class="title">
				<?php echo JHTML::_('grid.sort',   'Country Name', 'parent', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>
			<th width="5%" align="center">
				<?php echo JHTML::_('grid.sort',   'Published', 'published', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>			
			<th width="1%" nowrap="nowrap">
				<?php echo JHTML::_('grid.sort',   'ID', 'id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>
		</tr>
	</thead>
    
    
<tbody>
	<?php
	$k = 0;
	for ($i=0, $n=count( $this->items ); $i < $n; $i++)
	{
		$row = &$this->items[$i];
$link = JRoute::_( 'index.php?option=com_properties&controller=property&table='.$TableName.'&task=edit&cid[]='. $row->id);
		

//$checked 	= JHTML::_('grid.id',   $i, $row->id_categoria );
//$checked 	= JHTML::_('grid.checkedout',   $row, $i );
		
		$checked 	= JHTML::_('grid.id',  $i, $row->id );
		$published 	= JHTML::_('grid.published', $row, $i );
	?>
		<tr class="<?php echo "row$k"; ?>">
			<td width="5%">
				<?php echo $this->pagination->getRowOffset( $i ); ?>
			</td>
			<td width="5%">
				<?php echo $checked; ?>
			</td>
			<td>
			<?php //if (  JTable::isCheckedOut($this->user->get ('id'), $row->checked_out )  ) {
				//echo $row->title;
			//} else {
				?>
				<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit state' );?>::<?php echo $row->name; ?>">
				<a href="<?php echo $link  ?>">
					<?php echo $row->name; ?></a></span>
				<?php
			//}
			?>
			</td>
            <td align="center">
				<?php echo $row->name_country;?>
			</td>
			<td align="center">
				<?php echo $published;?>
			</td>			
			<td align="center">
				<?php echo $row->id; ?>
			</td>
		</tr>
		<?php
			$k = 1 - $k;
		}
		?>
	</tbody>     

<tfoot>
    <tr>
      <td colspan="13"><?php echo $this->pagination->getListFooter(); ?></td>
    </tr>
  </tfoot>
</table>
</div>
<input type="hidden" name="option" value="com_properties" />
<input type="hidden" name="table" value="<?php echo $TableName; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
<input type="hidden" name="controller" value="property" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
<?php	
break;	

case 'locality' :	
?>
<form action="index.php" method="post" name="adminForm">
<table>
	<tr>
		<td align="left" width="100%">
			<?php echo JText::_( 'Filter' ); ?>:
			<input type="text" name="search" id="search" value="<?php echo $this->lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
			<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
			<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
		</td>
		<td nowrap="nowrap">
			<?php echo $this->lists['state']; ?>
		</td>
	</tr>
</table>
<div id="tablecell">
	<table class="adminlist">
	<thead>
		<tr>
			<th width="5">
				<?php echo JText::_( 'NUM' ); ?>
			</th>
			<th  width="5%">
				<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
			</th>
			<th  class="title">
				<?php echo JHTML::_('grid.sort',   'Locality Name', 'name', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>
            <th width="5%" align="center">
				<?php echo JHTML::_('grid.sort',   'State Name', 'parent', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>	
             <th width="5%" align="center">
				<?php echo JHTML::_('grid.sort',   'Country Name', 'cid', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>
			<th width="5%" align="center">
				<?php echo JHTML::_('grid.sort',   'Published', 'published', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>
					
			<th width="1%" nowrap="nowrap">
				<?php echo JHTML::_('grid.sort',   'ID', 'id', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
			</th>
		</tr>
	</thead>
	
	<tbody>
	<?php
	$k = 0;
	for ($i=0, $n=count( $this->items ); $i < $n; $i++)
	{
		$row = &$this->items[$i];
$link = JRoute::_( 'index.php?option=com_properties&controller=property&table='.$TableName.'&task=edit&cid[]='. $row->id);
		

//$checked 	= JHTML::_('grid.id',   $i, $row->id_categoria );
//$checked 	= JHTML::_('grid.checkedout',   $row, $i );
		
		$checked 	= JHTML::_('grid.id',  $i, $row->id );
		$published 	= JHTML::_('grid.published', $row, $i );
		
	?>
		<tr class="<?php echo "row$k"; ?>">
			<td width="5%">
				<?php echo $this->pagination->getRowOffset( $i ); ?>
			</td>
			<td width="5%">
				<?php echo $checked; ?>
			</td>
			<td>
			<?php //if (  JTable::isCheckedOut($this->user->get ('id'), $row->checked_out )  ) {
				//echo $row->title;
			//} else {
				?>
				<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Locality' );?>::<?php echo $row->name; ?>">
				<a href="<?php echo $link  ?>">
					<?php echo $row->name; ?></a></span>
				<?php
			//}
			?>
            <td align="center">
				<?php echo $row->name_state; ?>
			</td>	
            <td align="center">
				<?php echo $row->name_country; ?>
			</td>		
			</td>
			<td align="center">
				<?php echo $published;?>
			</td>
			
			<td align="center">
				<?php echo $row->id; ?>
			</td>
		</tr>
		<?php
			$k = 1 - $k;
		}
		?>
	</tbody>
    <tfoot>
    <tr>
      <td colspan="13"><?php echo $this->pagination->getListFooter(); ?></td>
    </tr>
  </tfoot>
	</table>
</div>

<input type="hidden" name="option" value="com_properties" />
<input type="hidden" name="table" value="<?php echo $TableName; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
<input type="hidden" name="controller" value="property" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>	
<?php
break;	

case 'manual' :	
?>
1.- Install component.
2.- Go to Component Properties
3.- Right Top buttom Parameters and configure options
4.- Add Category (For sale, Rent, New, Vacational rent.. )
5.- Add type property (Apartment, house, ...)
6.- Add Country.(USA, Deutschland, Russia, Espana,...)
7.- Add State.(Texas, Bshern, Moscow, Madrid...)
8.- Add Locality (Dallas, Munich, Moscow, Madrid...)
9.- Add Profiles (Agent data: Client is a user joomla registered) Can change permissions in User Manager to 'Agent' , then this user can published various properties. 10.- Add Properties
10.- Add Properties
11.-Control Panel , button Create Menus : automatically creates menus in FrontEnd :All Properties,My Short List(Favourites),My Panel(to publish properties),My Profile. You can change names after created.
12.-Good Luck ;)
<br />
<?php
break;


case 'menus' :	
echo 'menus creados';
break;
}
?>